{{define "content"}}
    <div class="mx-3">
      <form action="{{.FilterFormURL}}">
        <div class="row align-items-center">
          <div class="col-auto col-sm-3">
            <label for="inputCc">Cc'd</label>
            <input type="text" name="cc" class="form-control mb-3" value="{{.Filter.Cc}}" id="inputCc">
          </div>
          <div class="col-auto col-sm-3">
            <label for="inputStatus">Status</label>
            <select id="inputStatus" class="form-control mb-3" name="status">
              {{$filter := .Filter}}
              {{range .Statuses}}
                <option value="{{.Key}}" {{if eq .Key $filter.Status}} selected{{end}}>{{.Value}}</option>
              {{end}}
            </select>
          </div>
          <div class="form-check col-auto">
            <input class="form-check-input" type="checkbox" name="with_findings" value="true"
                   id="onlyWithFindings"{{if .Filter.WithFindings}} checked=""{{end}}>
            <label class="form-check-label" for="onlyWithFindings">
              Only with findings
            </label>
          </div>
          <div class="col-auto">
            <button type="submit" class="btn btn-primary">Filter</button>
          </div>
        </div>
      </form>
    </div>

    {{if or .PrevPageURL .NextPageURL}}
    <nav class="mx-3">
      <ul class="pagination">
        <li class="page-item {{if not .PrevPageURL}}disabled{{end}}">
          <a class="page-link" href="{{.PrevPageURL}}" tabindex="-1">Previous</a>
        </li>
        <li class="page-item {{if not .NextPageURL}}disabled{{end}}">
          <a class="page-link" href="{{.NextPageURL}}">Next</a>
        </li>
      </ul>
    </nav>
    {{end}}

    <table class="table">
      <thead class="thead-light">
        <tr>
          <th scope="col">Published</th>
          <th scope="col">Title</th>
          <th scope="col">Version</th>
          <th scope="col">Author</th>
          <th scope="col">Status</th>
        </tr>
      </thead>
      <tbody>
        {{range .List}}
        <tr>
          <td>{{.Series.PublishedAt.Format "2006-01-02 15:04 MST"}}</td>
          <td><a href="/series/{{.Series.ID}}">{{.Series.Title}}</a></td>
          <td>{{.Series.Version}}</td>
          <td>{{.Series.AuthorEmail}}</td>
          <td>
            {{if .Session}}
              {{.Session.Status}}
              {{if eq .Session.Status "finished"}}in {{.Session.Duration}}{{end}}
              {{if gt .Findings 0}}<br /><b>[{{.Findings}} findings]</b>{{end}}
            {{else}}
              -
            {{end}}
          </td>
        </tr>
        {{end}}
      </tbody>
    </table>
{{end}}
    
